package com.roadjava.GDOUGym.bean.dto;

import com.roadjava.GDOUGym.bean.entity.EquipmentDO;
import com.roadjava.GDOUGym.constants.Constants;
import lombok.Data;

import java.util.List;

@Data
public class EquipmentDTO extends EquipmentDO {
    /**
     * 当前是第几页
     */
    private Integer pageNow;
    /**
     * 每页展示多少条
     */
    private Integer pageSize;

    /**
     * 可访问的路径:
     * http://localhost:8888/ssm_student_war_exploded/resources/imgs/xxx.png
     */
    private String addressablePhotoPath;

    private List<Long> idsToDelete;

    /**
     * limit 0,10
     * @return
     */
    public Integer getStart() {
        if (getPageNow() == null) {
            return null;
        }
        return (getPageNow() - 1) * getPageSize();
    }

    public Integer getPageSize() {
        return pageSize != null ? pageSize : Constants.PAGE_SIZE;
    }
}
